import request from '@/utils/request';

// 登录方法
export function login(username: string, password: string, code: string, uuid: string) {
    const data = {
        username,
        password,
        code,
        uuid,
    };
    return request({
        url: '/login',
        headers: {
            isToken: false,
        },
        method: 'post',
        data: data,
    });
}
// 私教课程
export function tienchin(pageNum: any, pageSize: any) {
    // console.log('Request data:', data);
    return request({
        url: `/tienchin/course/list?pageNum=${pageNum}&pageSize=${pageSize}`,
        headers: {
            isToken: true,
        },
        method: 'get',
        // data: data,
    });
}
// 搜所
export function tienchinSouSuo(applyTo: any, maxPrice: any, minPrice: any, name: any, type: any) {
    return request({
        url: `/tienchin/course/list?applyTo=${applyTo}&maxPrice=${maxPrice}&minPrice=${minPrice}&name=${name}&type=${type}`,
        headers: {
            isToken: true,
        },
        method: 'get',
        // data: data,
    });
}
// 删除
export function tienchinDelete(data: any) {
    console.log('Request data:', data);
    return request({
        url: '/tienchin/course/' + data,
        headers: {
            isToken: true,
        },
        method: 'DELETE',
        data: data,
    });
}
// 新增
export function tienchinAdd(data: any) {
    console.log('Request data:', data);
    return request({
        url: '/tienchin/course',
        headers: {
            isToken: true,
        },
        method: 'POST',
        data: data,
    });
}
// 修改PUT
export function tienchinEdit(data: any) {
    console.log('Request data:', data);
    return request({
        url: '/tienchin/course',
        headers: {
            isToken: true,
        },
        method: 'PUT',
        data: data,
    });
}
// 统计分析
// 线索
export function statistic() {
    // console.log('Request data:', data);
    return request({
        url: '/tienchin/analysis/clue',
        headers: {
            isToken: true,
        },
        method: 'GET',
        // data: data,
    });
}
// 活动
export function activity() {
    // console.log('Request data:', data);
    return request({
        url: '/tienchin/analysis/activity',
        headers: {
            isToken: true,
        },
        method: 'GET',
        // data: data,
    });
}
// 活动搜索
// login.ts
import axios from 'axios';

// 活动搜索
// export function businessSouSuo(date: any) {
//     return axios.get('http://47.104.167.34:8100/tienchin/analysis/activity', {
//         params: {
//             pageNum: date.pageNum,
//             pageSize: date.pageSize,
//             'dateRange[0]': date.dateRange[0],
//             'dateRange[1]': date.dateRange[1],
//             'params[beginTime]': date.params.beginTime,
//             'params[endTime]': date.params.endTime,
//         },
//         // params: {
//         //     pageNum: 1,
//         //     pageSize: 10,
//         //     'dateRange[0]': '2024-12-27 12:00:00',
//         //     'dateRange[1]': '2024-12-28 12:00:00',
//         //     'params[beginTime]': '2024-12-27 12:00:00',
//         //     'params[endTime]': '2024-12-28 12:00:00'
//         // },
//         headers: {
//             isToken: true,
//         },
//     });
// }
export function businessSouSuo(date: any) {
    return request({
        url: `/tienchin/analysis/activity?pageNum=1&pageSize=10&dateRange%5B0%5D=2024-12-27%2012%3A00%3A00&dateRange%5B1%5D=2024-12-28%2012%3A00%3A00&params%5BbeginTime%5D=2024-12-27%2012%3A00%3A00&params%5BendTime%5D=2024-12-28%2012%3A00%3A00`,
        headers: {
            isToken: true,
        },
        method: 'GET',
        // data: data,
    });
}
// export function businessSouSuo(date: any) {
//     return request({
//         url: `/tienchin/analysis/activity?pageNum=1&pageSize=10&dateRange[0]=${date.dateRange[0]}&dateRange[1]=${date.dateRange[1]}&params[beginTime]=${date.params.beginTime}&params[endTime]=${date.params.endTime}`,
//         headers: {
//             isToken: true,
//         },
//         method: 'GET',
//         // data: data,
//     });
// }
// 商机
export function business() {
    // console.log('Request data:', data);
    return request({
        url: '/tienchin/analysis/business',
        headers: {
            isToken: true,
        },
        method: 'GET',
        // data: data,
    });
}

// 渠道
export function channel() {
    // console.log('Request data:', data);
    return request({
        url: '/tienchin/analysis/channel',
        headers: {
            isToken: true,
        },
        method: 'GET',
        // data: data,
    });
}








// 注册方法
export function register(data: any) {
    return request({
        url: '/register',
        headers: {
            isToken: false,
        },
        method: 'post',
        data: data,
    });
}

// 获取用户详细信息
export function getInfo() {
    return request({
        url: '/getInfo',
        method: 'get',
    });
}

// 退出方法
export function logout() {
    return request({
        url: '/logout',
        method: 'post',
    });
}

// 获取验证码
export function getCodeImg() {
    return request({
        url: '/captchaImage',
        headers: {
            isToken: false,
        },
        method: 'get',
        timeout: 20000,
    });
}
